06. Exercise: Create and Initialize a Paint and a Path Object
23 6 AAK Paint And Path SC V2
Exercise
In this exercise you will create and initialize a Paint and a Path Object.
Switch to the
ClippedViewclass.In
ClippedViewdefine a variablepaintof aPaint.a. Enable anti-aliasing,
b. and use the stroke width and
c. text size defined in the dimensions.
private val paint = Paint().apply {
// Smooth out edges of what is drawn without affecting shape.
isAntiAlias = true
strokeWidth = resources.getDimension(R.dimen.strokeWidth)
textSize = resources.getDimension(R.dimen.textSize)
}
- In
ClippedView, create and initialize apathvariable of aPathto store locally the path of what has been drawn. Importandroid.graphics.Path.
private val path = Path()